;(function(){
	'use strict';
	/**
	 * 银行总对总页面控制器
	 * stStatisticsCtrl用于表单控制
	 */
	angular.module('controllers.omdisplay.bankATA')
		.controller('stStatisticsCtrl', stStatisticsCtrl);
	/**
	 * @param $scope
	 * @param stStatisticsServe  请求服务
	 * @param staticData         静态初始化数据
	 * @param response           返回数据服务
	 * @param BankAtaServer      方法集合
	 * @param COREDATA           公共静态数据
	 * @param stDataRequest      通过点击的方法进行查询
	 */
	function stStatisticsCtrl($scope, stStatisticsServe,staticData,response,BankAtaServer, COREDATA,stDataRequest,QueryBankList) {
		var myEcharts = echarts.init(document.getElementById('sign'));      //签约饼图对象
		var termEcharts = echarts.init(document.getElementById('term'));    //解约饼图对象
		$scope.timeTypes = COREDATA.TIMETYPES;                              //帐期数据
		$scope.quarters = COREDATA.QUARTERS.map(function(item){
			return {code:item.quarterCode,quarterName:item.quarterName};      // 季度数据
		});
		$scope.provinces = COREDATA.PROVINCES;   //所有省份的静态数据
		$scope.errorInfo = COREDATA.ERRORINFO;   //日期错误信息
		staticData.getData();                    //执行页面绑定数据的初始化
		response.setData();

		$scope.tradeTypes = staticData.changeData.tradeTypes;  //交易类型数组
		$scope.translate = staticData.changeData.translate;    //页面绑定的ng-model 数据对象
		//给银行默认值
		$scope.translate.bankCode = QueryBankList[0].bankCode;
		//银行数据
		$scope.banks = QueryBankList;

		$scope.flagObj = staticData.changeData.flagName;       //所有页面的判断属性
		$scope.response = response;                            //页面展示数据
		$scope.businessStateQuery = stStatisticsServe.queryStates;  //请求业务状态 未签约，已签约....
		$scope.bankQuery = stStatisticsServe.queryBankList;     //银行下拉框查询
		$scope.signChannelQuery = stStatisticsServe.querySignChannel;  //签约渠道

    //监控账期变化默认时间也变化
		$scope.$watch('translate.timeTypeCode',function(newValue){
			$scope.translate = BankAtaServer.searchTimeInit(newValue.timeTypeCode,$scope.translate,'initTime');
		});
		$scope.params = staticData.changeData.params;        //分页所要传给指令的参数
		// $scope.params.page = {pageSize:'10',currentPage:'1'};
		$scope.clickForm = staticData.changeData.clickForm;  //没有查到数据时，点击图标所使用的查询参数
		//页面查询总对总签解约数据
		$scope.searchST =  stDataRequest.searchST;
		$scope.pageQuery = stDataRequest.pageQuery;          //分页查询
		$scope.changeTable = stDataRequest.changeTable;      //点击表格进行查询
		$scope.changeView =  stDataRequest.changeView(myEcharts,termEcharts);  //点击图表进行查询

		$scope.formPrefixTable = COREDATA.FORMPREFIX + 'OMdisplay/bankATA/exportExcel'; //表导出的请求地址
		$scope.formPrefixView = COREDATA.FORMPREFIX + 'OMdisplay/bankATA/exportChartExcel'; //图导出的请求地址
	}
	//签解约控制器的服务注入
	stStatisticsCtrl.$inject = ['$scope', 'stStatisticsServe','staticData','response','BankAtaServer','COREDATA','stDataRequest','QueryBankList'];
})();









